// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗   ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗  ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║   ██║   ██║   ██║██║     █████╗
// ██║╚██╗██║██║   ██║   ██║   ██║██║     ██╔══╝
// ██║ ╚████║╚██████╔╝   ██║   ██║╚██████╗███████╗
// ╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

#nullable restore

using System;
using System.Linq;
using Elastic.Clients.Elasticsearch.Serialization;

namespace Elastic.Clients.Elasticsearch.IndexLifecycleManagement;

[System.Text.Json.Serialization.JsonConverter(typeof(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.Json.AllocateActionConverter))]
public sealed partial class AllocateAction
{
#if NET7_0_OR_GREATER
	public AllocateAction()
	{
	}
#endif
#if !NET7_0_OR_GREATER
	public AllocateAction()
	{
	}
#endif
	[System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
	internal AllocateAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel sentinel)
	{
		_ = sentinel;
	}

	public System.Collections.Generic.IDictionary<string, string>? Exclude { get; set; }
	public System.Collections.Generic.IDictionary<string, string>? Include { get; set; }
	public int? NumberOfReplicas { get; set; }
	public System.Collections.Generic.IDictionary<string, string>? Require { get; set; }
	public int? TotalShardsPerNode { get; set; }
}

public readonly partial struct AllocateActionDescriptor
{
	internal Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateAction Instance { get; init; }

	[System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
	public AllocateActionDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateAction instance)
	{
		Instance = instance;
	}

	[System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
	public AllocateActionDescriptor()
	{
		Instance = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance);
	}

	public static explicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateActionDescriptor(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateAction instance) => new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateActionDescriptor(instance);
	public static implicit operator Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateAction(Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateActionDescriptor descriptor) => descriptor.Instance;

	public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateActionDescriptor Exclude(System.Collections.Generic.IDictionary<string, string>? value)
	{
		Instance.Exclude = value;
		return this;
	}

	public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateActionDescriptor Exclude()
	{
		Instance.Exclude = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null);
		return this;
	}

	public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateActionDescriptor Exclude(System.Action<Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString>? action)
	{
		Instance.Exclude = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action);
		return this;
	}

	public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateActionDescriptor AddExclude(string key, string value)
	{
		Instance.Exclude ??= new System.Collections.Generic.Dictionary<string, string>();
		Instance.Exclude.Add(key, value);
		return this;
	}

	public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateActionDescriptor Include(System.Collections.Generic.IDictionary<string, string>? value)
	{
		Instance.Include = value;
		return this;
	}

	public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateActionDescriptor Include()
	{
		Instance.Include = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null);
		return this;
	}

	public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateActionDescriptor Include(System.Action<Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString>? action)
	{
		Instance.Include = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action);
		return this;
	}

	public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateActionDescriptor AddInclude(string key, string value)
	{
		Instance.Include ??= new System.Collections.Generic.Dictionary<string, string>();
		Instance.Include.Add(key, value);
		return this;
	}

	public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateActionDescriptor NumberOfReplicas(int? value)
	{
		Instance.NumberOfReplicas = value;
		return this;
	}

	public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateActionDescriptor Require(System.Collections.Generic.IDictionary<string, string>? value)
	{
		Instance.Require = value;
		return this;
	}

	public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateActionDescriptor Require()
	{
		Instance.Require = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(null);
		return this;
	}

	public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateActionDescriptor Require(System.Action<Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString>? action)
	{
		Instance.Require = Elastic.Clients.Elasticsearch.Fluent.FluentDictionaryOfStringString.Build(action);
		return this;
	}

	public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateActionDescriptor AddRequire(string key, string value)
	{
		Instance.Require ??= new System.Collections.Generic.Dictionary<string, string>();
		Instance.Require.Add(key, value);
		return this;
	}

	public Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateActionDescriptor TotalShardsPerNode(int? value)
	{
		Instance.TotalShardsPerNode = value;
		return this;
	}

	[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
	internal static Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateAction Build(System.Action<Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateActionDescriptor>? action)
	{
		if (action is null)
		{
			return new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance);
		}

		var builder = new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateActionDescriptor(new Elastic.Clients.Elasticsearch.IndexLifecycleManagement.AllocateAction(Elastic.Clients.Elasticsearch.Serialization.JsonConstructorSentinel.Instance));
		action.Invoke(builder);
		return builder.Instance;
	}
}